<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>标识符管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
	
	function getIdentifierTypeID(obj) {
		var id = $(obj).parent().parent().children("td:eq(0)").html();
		var entityName = $(obj).parent().parent().children("td:eq(1)").html();
		var entityDes = $(obj).parent().parent().children("td:eq(2)").html();
		var identifierTypeId =$(obj).parent().parent().children("td:eq(3)").children("select").val();
		var rule = $(obj).parent().parent().children("td:eq(4)").children("input").val();
		var length =$(obj).parent().parent().children("td:eq(5)").children("input").val();
		
		$.post("${ctx}/sys/identifier/save","id="+id+"&entityName="+entityName+"&entityDes="+entityDes+"&identifierType.id="+identifierTypeId+
				"&rule="+rule+"&length="+length,function(data){
			jBox.tip("保存'"+eval(data)+"'成功！");
		})
		jBox.tip("保存成功！");
		}
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
	</script>
</head>
<body class="fixed-top">
	<div class="container" style="width: 100%;">
		<div style="margin: 20px; border: 1px solid #c8d1d5;">
			<div style="padding: 13px; background-color: #f4f4f4; border-bottom: 1px solid #c8d1d5;">
				<h4>
					<i class="icon-globe"></i> 标识符管理
				</h4>
			</div>
			<div style="margin: 17px;">
				<form id="searchForm" modelAttribute = "identifier" action="${ctx}/sys/identifier/" method="post" class="breadcrumb form-search">
					<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
					<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />
					<ul class="ul-form">
						<li><label>表名：</label>
							<input type="text" class="input-medium"/>
						</li>
						<li class="btns">
							<a class="btn btn-primary" href="javascript:void(0)" onclick="return page();">
							<i class="icon-search"></i>&nbsp;搜索</a>
						</li>
					</ul>
				</form>
				<sys:message content="${message}" />
				<table id="contentTable" class="table table-striped table-bordered table-condensed">
					<thead>
						<tr>
							<th style="display: none;">ID</th>
							<th>表名</th>
							<th>描述</th>
							<th>类型</th>
							<th>规则</th>
							<th>长度</th>
							<shiro:hasPermission name="sys:identifier:edit">
								<th>操作</th>
							</shiro:hasPermission>
						</tr>
					</thead>
					<tbody>
					<c:forEach items="${page.list}" var="identifier">
						<tr>
							<td style="display: none;">${identifier.id}</td>
							<td>${identifier.entityName}</td>
							<td>${identifier.entityDes}</td>
							<td>
							 <select >
								 <c:forEach items="${pageIdentifierType.list}" var="identifierType">
									<option value="${identifierType.id}" id="id">${identifierType.name}</option>
								 </c:forEach>
							</select> 
							</td>
							<td><input type="text" id="" value="${identifier.rule}"></td>
							<td><input type="number" id="" value="${identifier.length}" /></td>
							<shiro:hasPermission name="sys:identifier:edit">
								<td><a href="javascript:" onclick="getIdentifierTypeID(this)"><i class="icon-save"></i></a>
								
								</td>
							</shiro:hasPermission>
						</tr>
					 </c:forEach> 
					</tbody>
				</table>
				<div class="pagination">${page}</div>
			</div>
		</div>
	</div>
</body>
</html>